
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>方法 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../../../../../0/style.css">

    
            
                
                <link rel="stylesheet" href="../../../../../../0/website.css">
                
            
                
                <link rel="stylesheet" href="../../../../../../0/search.css">
                
            
                
                <link rel="stylesheet" href="../../../../../../0/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="12_Subscripts.html" />
    
    
    <link rel="prev" href="10_Properties.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    欢迎使用 Swift
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../chapter1/01_about_swift.html">
            
                <a href="../chapter1/01_about_swift.html">
            
                    
                    关于 Swift
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../chapter1/02_version_compatibility.html">
            
                <a href="../chapter1/02_version_compatibility.html">
            
                    
                    版本兼容性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../chapter1/03_a_swift_tour.html">
            
                <a href="../chapter1/03_a_swift_tour.html">
            
                    
                    Swift 初见
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../chapter1/04_revision_history.html">
            
                <a href="../chapter1/04_revision_history.html">
            
                    
                    Swift 版本历史记录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    Swift 教程
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="01_The_Basics.html">
            
                <a href="01_The_Basics.html">
            
                    
                    基础部分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="02_Basic_Operators.html">
            
                <a href="02_Basic_Operators.html">
            
                    
                    基本运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="03_Strings_and_Characters.html">
            
                <a href="03_Strings_and_Characters.html">
            
                    
                    字符串和字符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="04_Collection_Types.html">
            
                <a href="04_Collection_Types.html">
            
                    
                    集合类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="05_Control_Flow.html">
            
                <a href="05_Control_Flow.html">
            
                    
                    控制流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="06_Functions.html">
            
                <a href="06_Functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="07_Closures.html">
            
                <a href="07_Closures.html">
            
                    
                    闭包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="08_Enumerations.html">
            
                <a href="08_Enumerations.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="09_Structures_And_Classes.html">
            
                <a href="09_Structures_And_Classes.html">
            
                    
                    类和结构体
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="10_Properties.html">
            
                <a href="10_Properties.html">
            
                    
                    属性
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.11" data-path="11_Methods.html">
            
                <a href="11_Methods.html">
            
                    
                    方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="12_Subscripts.html">
            
                <a href="12_Subscripts.html">
            
                    
                    下标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="13_Inheritance.html">
            
                <a href="13_Inheritance.html">
            
                    
                    继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="14_Initialization.html">
            
                <a href="14_Initialization.html">
            
                    
                    构造过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="15_Deinitialization.html">
            
                <a href="15_Deinitialization.html">
            
                    
                    析构过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="16_Optional_Chaining.html">
            
                <a href="16_Optional_Chaining.html">
            
                    
                    可选链
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="17_Error_Handling.html">
            
                <a href="17_Error_Handling.html">
            
                    
                    错误处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="18_Type_Casting.html">
            
                <a href="18_Type_Casting.html">
            
                    
                    类型转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="19_Nested_Types.html">
            
                <a href="19_Nested_Types.html">
            
                    
                    嵌套类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="20_Extensions.html">
            
                <a href="20_Extensions.html">
            
                    
                    扩展
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="21_Protocols.html">
            
                <a href="21_Protocols.html">
            
                    
                    协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="22_Generics.html">
            
                <a href="22_Generics.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="23_Automatic_Reference_Counting.html">
            
                <a href="23_Automatic_Reference_Counting.html">
            
                    
                    自动引用计数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.24" data-path="24_Memory_Safety.html">
            
                <a href="24_Memory_Safety.html">
            
                    
                    内存安全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.25" data-path="25_Access_Control.html">
            
                <a href="25_Access_Control.html">
            
                    
                    访问控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.26" data-path="26_Advanced_Operators.html">
            
                <a href="26_Advanced_Operators.html">
            
                    
                    高级运算符
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    语言参考
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter3/01_About_the_Language_Reference.html">
            
                <a href="../chapter3/01_About_the_Language_Reference.html">
            
                    
                    关于语言参考
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter3/02_Lexical_Structure.html">
            
                <a href="../chapter3/02_Lexical_Structure.html">
            
                    
                    词法结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../chapter3/03_Types.html">
            
                <a href="../chapter3/03_Types.html">
            
                    
                    类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../chapter3/04_Expressions.html">
            
                <a href="../chapter3/04_Expressions.html">
            
                    
                    表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../chapter3/05_Statements.html">
            
                <a href="../chapter3/05_Statements.html">
            
                    
                    语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../chapter3/06_Declarations.html">
            
                <a href="../chapter3/06_Declarations.html">
            
                    
                    声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../chapter3/07_Attributes.html">
            
                <a href="../chapter3/07_Attributes.html">
            
                    
                    特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../chapter3/08_Patterns.html">
            
                <a href="../chapter3/08_Patterns.html">
            
                    
                    模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../chapter3/09_Generic_Parameters_and_Arguments.html">
            
                <a href="../chapter3/09_Generic_Parameters_and_Arguments.html">
            
                    
                    泛型参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../chapter3/10_Summary_of_the_Grammar.html">
            
                <a href="../chapter3/10_Summary_of_the_Grammar.html">
            
                    
                    语法总结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    翻译贡献者
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../contributors.html">
            
                <a href="../contributors.html">
            
                    
                    翻译贡献者
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >方法</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x65B9;&#x6CD5;">&#x65B9;&#x6CD5;</h1>
<p><em>&#x65B9;&#x6CD5;</em>&#x662F;&#x4E0E;&#x67D0;&#x4E9B;&#x7279;&#x5B9A;&#x7C7B;&#x578B;&#x76F8;&#x5173;&#x8054;&#x7684;&#x51FD;&#x6570;&#x3002;&#x7C7B;&#x3001;&#x7ED3;&#x6784;&#x4F53;&#x3001;&#x679A;&#x4E3E;&#x90FD;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#xFF1B;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x4E3A;&#x7ED9;&#x5B9A;&#x7C7B;&#x578B;&#x7684;&#x5B9E;&#x4F8B;&#x5C01;&#x88C5;&#x4E86;&#x5177;&#x4F53;&#x7684;&#x4EFB;&#x52A1;&#x4E0E;&#x529F;&#x80FD;&#x3002;&#x7C7B;&#x3001;&#x7ED3;&#x6784;&#x4F53;&#x3001;&#x679A;&#x4E3E;&#x4E5F;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#xFF1B;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x4E0E;&#x7C7B;&#x578B;&#x672C;&#x8EAB;&#x76F8;&#x5173;&#x8054;&#x3002;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x4E0E; Objective-C &#x4E2D;&#x7684;&#x7C7B;&#x65B9;&#x6CD5;&#xFF08;class methods&#xFF09;&#x76F8;&#x4F3C;&#x3002;</p>
<p>&#x7ED3;&#x6784;&#x4F53;&#x548C;&#x679A;&#x4E3E;&#x80FD;&#x591F;&#x5B9A;&#x4E49;&#x65B9;&#x6CD5;&#x662F; Swift &#x4E0E; C/Objective-C &#x7684;&#x4E3B;&#x8981;&#x533A;&#x522B;&#x4E4B;&#x4E00;&#x3002;&#x5728; Objective-C &#x4E2D;&#xFF0C;&#x7C7B;&#x662F;&#x552F;&#x4E00;&#x80FD;&#x5B9A;&#x4E49;&#x65B9;&#x6CD5;&#x7684;&#x7C7B;&#x578B;&#x3002;&#x4F46;&#x5728; Swift &#x4E2D;&#xFF0C;&#x4F60;&#x4E0D;&#x4EC5;&#x80FD;&#x9009;&#x62E9;&#x662F;&#x5426;&#x8981;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x7C7B;/&#x7ED3;&#x6784;&#x4F53;/&#x679A;&#x4E3E;&#xFF0C;&#x8FD8;&#x80FD;&#x7075;&#x6D3B;&#x5730;&#x5728;&#x4F60;&#x521B;&#x5EFA;&#x7684;&#x7C7B;&#x578B;&#xFF08;&#x7C7B;/&#x7ED3;&#x6784;&#x4F53;/&#x679A;&#x4E3E;&#xFF09;&#x4E0A;&#x5B9A;&#x4E49;&#x65B9;&#x6CD5;&#x3002;</p>
<h2 id="instance-methods">&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#xFF08;Instance Methods&#xFF09; </h2>
<p><em>&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;</em>&#x662F;&#x5C5E;&#x4E8E;&#x67D0;&#x4E2A;&#x7279;&#x5B9A;&#x7C7B;&#x3001;&#x7ED3;&#x6784;&#x4F53;&#x6216;&#x8005;&#x679A;&#x4E3E;&#x7C7B;&#x578B;&#x5B9E;&#x4F8B;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x63D0;&#x4F9B;&#x8BBF;&#x95EE;&#x548C;&#x4FEE;&#x6539;&#x5B9E;&#x4F8B;&#x5C5E;&#x6027;&#x7684;&#x65B9;&#x6CD5;&#x6216;&#x63D0;&#x4F9B;&#x4E0E;&#x5B9E;&#x4F8B;&#x76EE;&#x7684;&#x76F8;&#x5173;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x5E76;&#x4EE5;&#x6B64;&#x6765;&#x652F;&#x6491;&#x5B9E;&#x4F8B;&#x7684;&#x529F;&#x80FD;&#x3002;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x7684;&#x8BED;&#x6CD5;&#x4E0E;&#x51FD;&#x6570;&#x5B8C;&#x5168;&#x4E00;&#x81F4;&#xFF0C;&#x8BE6;&#x60C5;&#x53C2;&#x89C1; <a href="06_Functions.html">&#x51FD;&#x6570;</a>&#x3002;</p>
<p>&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x8981;&#x5199;&#x5728;&#x5B83;&#x6240;&#x5C5E;&#x7684;&#x7C7B;&#x578B;&#x7684;&#x524D;&#x540E;&#x5927;&#x62EC;&#x53F7;&#x4E4B;&#x95F4;&#x3002;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x80FD;&#x591F;&#x9690;&#x5F0F;&#x8BBF;&#x95EE;&#x5B83;&#x6240;&#x5C5E;&#x7C7B;&#x578B;&#x7684;&#x6240;&#x6709;&#x7684;&#x5176;&#x4ED6;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x548C;&#x5C5E;&#x6027;&#x3002;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x53EA;&#x80FD;&#x88AB;&#x5B83;&#x6240;&#x5C5E;&#x7684;&#x7C7B;&#x7684;&#x67D0;&#x4E2A;&#x7279;&#x5B9A;&#x5B9E;&#x4F8B;&#x8C03;&#x7528;&#x3002;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x4E0D;&#x80FD;&#x8131;&#x79BB;&#x4E8E;&#x73B0;&#x5B58;&#x7684;&#x5B9E;&#x4F8B;&#x800C;&#x88AB;&#x8C03;&#x7528;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#xFF0C;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x5F88;&#x7B80;&#x5355;&#x7684; <code>Counter</code> &#x7C7B;&#xFF0C;<code>Counter</code> &#x80FD;&#x88AB;&#x7528;&#x6765;&#x5BF9;&#x4E00;&#x4E2A;&#x52A8;&#x4F5C;&#x53D1;&#x751F;&#x7684;&#x6B21;&#x6570;&#x8FDB;&#x884C;&#x8BA1;&#x6570;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Counter</span> </span>{
    <span class="hljs-keyword">var</span> <span class="hljs-built_in">count</span> = <span class="hljs-number">0</span>
    <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">increment</span><span class="hljs-params">()</span></span> {
        <span class="hljs-built_in">count</span> += <span class="hljs-number">1</span>
    }
    <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">increment</span><span class="hljs-params">(by amount: Int)</span></span> {
        <span class="hljs-built_in">count</span> += amount
    }
    <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">reset</span><span class="hljs-params">()</span></span> {
        <span class="hljs-built_in">count</span> = <span class="hljs-number">0</span>
    }
}
</code></pre>
<p><code>Counter</code> &#x7C7B;&#x5B9A;&#x4E49;&#x4E86;&#x4E09;&#x4E2A;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#xFF1A;</p>
<ul>
<li><code>increment</code> &#x8BA9;&#x8BA1;&#x6570;&#x5668;&#x6309;&#x4E00;&#x9012;&#x589E;&#xFF1B;</li>
<li><code>increment(by: Int)</code> &#x8BA9;&#x8BA1;&#x6570;&#x5668;&#x6309;&#x4E00;&#x4E2A;&#x6307;&#x5B9A;&#x7684;&#x6574;&#x6570;&#x503C;&#x9012;&#x589E;&#xFF1B;</li>
<li><code>reset</code> &#x5C06;&#x8BA1;&#x6570;&#x5668;&#x91CD;&#x7F6E;&#x4E3A;0&#x3002;</li>
</ul>
<p><code>Counter</code> &#x8FD9;&#x4E2A;&#x7C7B;&#x8FD8;&#x58F0;&#x660E;&#x4E86;&#x4E00;&#x4E2A;&#x53EF;&#x53D8;&#x5C5E;&#x6027; <code>count</code>&#xFF0C;&#x7528;&#x5B83;&#x6765;&#x4FDD;&#x6301;&#x5BF9;&#x5F53;&#x524D;&#x8BA1;&#x6570;&#x5668;&#x503C;&#x7684;&#x8FFD;&#x8E2A;&#x3002;</p>
<p>&#x548C;&#x8C03;&#x7528;&#x5C5E;&#x6027;&#x4E00;&#x6837;&#xFF0C;&#x7528;&#x70B9;&#x8BED;&#x6CD5;&#xFF08;dot syntax&#xFF09;&#x8C03;&#x7528;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-keyword">let</span> counter = <span class="hljs-type">Counter</span>()
<span class="hljs-comment">// &#x521D;&#x59CB;&#x8BA1;&#x6570;&#x503C;&#x662F;0</span>
counter.increment()
<span class="hljs-comment">// &#x8BA1;&#x6570;&#x503C;&#x73B0;&#x5728;&#x662F;1</span>
counter.increment(by: <span class="hljs-number">5</span>)
<span class="hljs-comment">// &#x8BA1;&#x6570;&#x503C;&#x73B0;&#x5728;&#x662F;6</span>
counter.reset()
<span class="hljs-comment">// &#x8BA1;&#x6570;&#x503C;&#x73B0;&#x5728;&#x662F;0</span>
</code></pre>
<p>&#x51FD;&#x6570;&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x540C;&#x65F6;&#x6709;&#x4E00;&#x4E2A;&#x5C40;&#x90E8;&#x540D;&#x79F0;&#xFF08;&#x5728;&#x51FD;&#x6570;&#x4F53;&#x5185;&#x90E8;&#x4F7F;&#x7528;&#xFF09;&#x548C;&#x4E00;&#x4E2A;&#x5916;&#x90E8;&#x540D;&#x79F0;&#xFF08;&#x5728;&#x8C03;&#x7528;&#x51FD;&#x6570;&#x65F6;&#x4F7F;&#x7528;&#xFF09;&#xFF0C;&#x8BE6;&#x60C5;&#x53C2;&#x89C1; <a href="06_Functions.html#specifying_external_parameter_names">&#x6307;&#x5B9A;&#x5916;&#x90E8;&#x53C2;&#x6570;&#x540D;</a>&#x3002;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x4E5F;&#x4E00;&#x6837;&#xFF0C;&#x56E0;&#x4E3A;&#x65B9;&#x6CD5;&#x5C31;&#x662F;&#x51FD;&#x6570;&#xFF0C;&#x53EA;&#x662F;&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#x4E0E;&#x67D0;&#x4E2A;&#x7C7B;&#x578B;&#x76F8;&#x5173;&#x8054;&#x4E86;&#x3002;</p>
<h3 id="the-self-property">self &#x5C5E;&#x6027; </h3>
<p>&#x7C7B;&#x578B;&#x7684;&#x6BCF;&#x4E00;&#x4E2A;&#x5B9E;&#x4F8B;&#x90FD;&#x6709;&#x4E00;&#x4E2A;&#x9690;&#x542B;&#x5C5E;&#x6027;&#x53EB;&#x505A; <code>self</code>&#xFF0C;<code>self</code> &#x5B8C;&#x5168;&#x7B49;&#x540C;&#x4E8E;&#x8BE5;&#x5B9E;&#x4F8B;&#x672C;&#x8EAB;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x4E00;&#x4E2A;&#x5B9E;&#x4F8B;&#x7684;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x4E2D;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x9690;&#x542B;&#x7684; <code>self</code> &#x5C5E;&#x6027;&#x6765;&#x5F15;&#x7528;&#x5F53;&#x524D;&#x5B9E;&#x4F8B;&#x3002;</p>
<p>&#x4E0A;&#x9762;&#x4F8B;&#x5B50;&#x4E2D;&#x7684; <code>increment</code> &#x65B9;&#x6CD5;&#x8FD8;&#x53EF;&#x4EE5;&#x8FD9;&#x6837;&#x5199;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">increment</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">self</span>.<span class="hljs-built_in">count</span> += <span class="hljs-number">1</span>
}
</code></pre>
<p>&#x5B9E;&#x9645;&#x4E0A;&#xFF0C;&#x4F60;&#x4E0D;&#x5FC5;&#x5728;&#x4F60;&#x7684;&#x4EE3;&#x7801;&#x91CC;&#x9762;&#x7ECF;&#x5E38;&#x5199; <code>self</code>&#x3002;&#x4E0D;&#x8BBA;&#x4F55;&#x65F6;&#xFF0C;&#x53EA;&#x8981;&#x5728;&#x4E00;&#x4E2A;&#x65B9;&#x6CD5;&#x4E2D;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x5DF2;&#x77E5;&#x7684;&#x5C5E;&#x6027;&#x6216;&#x8005;&#x65B9;&#x6CD5;&#x540D;&#x79F0;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x6CA1;&#x6709;&#x660E;&#x786E;&#x5730;&#x5199; <code>self</code>&#xFF0C;Swift &#x5047;&#x5B9A;&#x4F60;&#x662F;&#x6307;&#x5F53;&#x524D;&#x5B9E;&#x4F8B;&#x7684;&#x5C5E;&#x6027;&#x6216;&#x8005;&#x65B9;&#x6CD5;&#x3002;&#x8FD9;&#x79CD;&#x5047;&#x5B9A;&#x5728;&#x4E0A;&#x9762;&#x7684; <code>Counter</code> &#x4E2D;&#x5DF2;&#x7ECF;&#x793A;&#x8303;&#x4E86;&#xFF1A;<code>Counter</code> &#x4E2D;&#x7684;&#x4E09;&#x4E2A;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x4E2D;&#x90FD;&#x4F7F;&#x7528;&#x7684;&#x662F; <code>count</code>&#xFF08;&#x800C;&#x4E0D;&#x662F; <code>self.count</code>&#xFF09;&#x3002;</p>
<p>&#x4F7F;&#x7528;&#x8FD9;&#x6761;&#x89C4;&#x5219;&#x7684;&#x4E3B;&#x8981;&#x573A;&#x666F;&#x662F;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x7684;&#x67D0;&#x4E2A;&#x53C2;&#x6570;&#x540D;&#x79F0;&#x4E0E;&#x5B9E;&#x4F8B;&#x7684;&#x67D0;&#x4E2A;&#x5C5E;&#x6027;&#x540D;&#x79F0;&#x76F8;&#x540C;&#x7684;&#x65F6;&#x5019;&#x3002;&#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x53C2;&#x6570;&#x540D;&#x79F0;&#x4EAB;&#x6709;&#x4F18;&#x5148;&#x6743;&#xFF0C;&#x5E76;&#x4E14;&#x5728;&#x5F15;&#x7528;&#x5C5E;&#x6027;&#x65F6;&#x5FC5;&#x987B;&#x4F7F;&#x7528;&#x4E00;&#x79CD;&#x66F4;&#x4E25;&#x683C;&#x7684;&#x65B9;&#x5F0F;&#x3002;&#x8FD9;&#x65F6;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>self</code> &#x5C5E;&#x6027;&#x6765;&#x533A;&#x5206;&#x53C2;&#x6570;&#x540D;&#x79F0;&#x548C;&#x5C5E;&#x6027;&#x540D;&#x79F0;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x4E2D;&#xFF0C;<code>self</code> &#x6D88;&#x9664;&#x65B9;&#x6CD5;&#x53C2;&#x6570; <code>x</code> &#x548C;&#x5B9E;&#x4F8B;&#x5C5E;&#x6027; <code>x</code> &#x4E4B;&#x95F4;&#x7684;&#x6B67;&#x4E49;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Point</span> </span>{
    <span class="hljs-keyword">var</span> x = <span class="hljs-number">0.0</span>, y = <span class="hljs-number">0.0</span>
    <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">isToTheRightOf</span><span class="hljs-params">(x: Double)</span></span> -&gt; <span class="hljs-type">Bool</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">self</span>.x &gt; x
    }
}
<span class="hljs-keyword">let</span> somePoint = <span class="hljs-type">Point</span>(x: <span class="hljs-number">4.0</span>, y: <span class="hljs-number">5.0</span>)
<span class="hljs-keyword">if</span> somePoint.isToTheRightOf(x: <span class="hljs-number">1.0</span>) {
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;This point is to the right of the line where x == 1.0&quot;</span>)
}
<span class="hljs-comment">// &#x6253;&#x5370;&#x201C;This point is to the right of the line where x == 1.0&#x201D;</span>
</code></pre>
<p>&#x5982;&#x679C;&#x4E0D;&#x4F7F;&#x7528; <code>self</code> &#x524D;&#x7F00;&#xFF0C;Swift&#x4F1A;&#x8BA4;&#x4E3A; <code>x</code> &#x7684;&#x4E24;&#x4E2A;&#x7528;&#x6CD5;&#x90FD;&#x5F15;&#x7528;&#x4E86;&#x540D;&#x4E3A; <code>x</code> &#x7684;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x3002;</p>
<h3 id="modifying-value-types-from-within-instance-methods">&#x5728;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x4E2D;&#x4FEE;&#x6539;&#x503C;&#x7C7B;&#x578B; </h3>
<p>&#x7ED3;&#x6784;&#x4F53;&#x548C;&#x679A;&#x4E3E;&#x662F;<em>&#x503C;&#x7C7B;&#x578B;</em>&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x503C;&#x7C7B;&#x578B;&#x7684;&#x5C5E;&#x6027;&#x4E0D;&#x80FD;&#x5728;&#x5B83;&#x7684;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x4E2D;&#x88AB;&#x4FEE;&#x6539;&#x3002;</p>
<p>&#x4F46;&#x662F;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x786E;&#x5B9E;&#x9700;&#x8981;&#x5728;&#x67D0;&#x4E2A;&#x7279;&#x5B9A;&#x7684;&#x65B9;&#x6CD5;&#x4E2D;&#x4FEE;&#x6539;&#x7ED3;&#x6784;&#x4F53;&#x6216;&#x8005;&#x679A;&#x4E3E;&#x7684;&#x5C5E;&#x6027;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x4E3A;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x9009;&#x62E9; <code>&#x53EF;&#x53D8;&#xFF08;mutating&#xFF09;</code>&#x884C;&#x4E3A;&#xFF0C;&#x7136;&#x540E;&#x5C31;&#x53EF;&#x4EE5;&#x4ECE;&#x5176;&#x65B9;&#x6CD5;&#x5185;&#x90E8;&#x6539;&#x53D8;&#x5B83;&#x7684;&#x5C5E;&#x6027;&#xFF1B;&#x5E76;&#x4E14;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x505A;&#x7684;&#x4EFB;&#x4F55;&#x6539;&#x53D8;&#x90FD;&#x4F1A;&#x5728;&#x65B9;&#x6CD5;&#x6267;&#x884C;&#x7ED3;&#x675F;&#x65F6;&#x5199;&#x56DE;&#x5230;&#x539F;&#x59CB;&#x7ED3;&#x6784;&#x4E2D;&#x3002;&#x65B9;&#x6CD5;&#x8FD8;&#x53EF;&#x4EE5;&#x7ED9;&#x5B83;&#x9690;&#x542B;&#x7684; <code>self</code> &#x5C5E;&#x6027;&#x8D4B;&#x4E88;&#x4E00;&#x4E2A;&#x5168;&#x65B0;&#x7684;&#x5B9E;&#x4F8B;&#xFF0C;&#x8FD9;&#x4E2A;&#x65B0;&#x5B9E;&#x4F8B;&#x5728;&#x65B9;&#x6CD5;&#x7ED3;&#x675F;&#x65F6;&#x4F1A;&#x66FF;&#x6362;&#x73B0;&#x5B58;&#x5B9E;&#x4F8B;&#x3002;</p>
<p>&#x8981;&#x4F7F;&#x7528; <code>&#x53EF;&#x53D8;</code>&#x65B9;&#x6CD5;&#xFF0C;&#x5C06;&#x5173;&#x952E;&#x5B57; <code>mutating</code> &#x653E;&#x5230;&#x65B9;&#x6CD5;&#x7684; <code>func</code> &#x5173;&#x952E;&#x5B57;&#x4E4B;&#x524D;&#x5C31;&#x53EF;&#x4EE5;&#x4E86;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Point</span> </span>{
    <span class="hljs-keyword">var</span> x = <span class="hljs-number">0.0</span>, y = <span class="hljs-number">0.0</span>
    <span class="hljs-keyword">mutating</span> <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">moveBy</span><span class="hljs-params">(x deltaX: Double, y deltaY: Double)</span></span> {
        x += deltaX
        y += deltaY
    }
}
<span class="hljs-keyword">var</span> somePoint = <span class="hljs-type">Point</span>(x: <span class="hljs-number">1.0</span>, y: <span class="hljs-number">1.0</span>)
somePoint.moveBy(x: <span class="hljs-number">2.0</span>, y: <span class="hljs-number">3.0</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;The point is now at (<span class="hljs-subst">\(somePoint.x)</span>, <span class="hljs-subst">\(somePoint.y)</span>)&quot;</span>)
<span class="hljs-comment">// &#x6253;&#x5370;&#x201C;The point is now at (3.0, 4.0)&#x201D;</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684; <code>Point</code> &#x7ED3;&#x6784;&#x4F53;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x53EF;&#x53D8;&#x65B9;&#x6CD5; <code>moveBy&#xFF08;x&#xFF1A;y :)</code> &#x6765;&#x79FB;&#x52A8; <code>Point</code> &#x5B9E;&#x4F8B;&#x5230;&#x7ED9;&#x5B9A;&#x7684;&#x4F4D;&#x7F6E;&#x3002;&#x8BE5;&#x65B9;&#x6CD5;&#x88AB;&#x8C03;&#x7528;&#x65F6;&#x4FEE;&#x6539;&#x4E86;&#x8FD9;&#x4E2A;&#x70B9;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x70B9;&#x3002;&#x65B9;&#x6CD5;&#x5B9A;&#x4E49;&#x65F6;&#x52A0;&#x4E0A;&#x4E86; <code>mutating</code> &#x5173;&#x952E;&#x5B57;&#xFF0C;&#x4ECE;&#x800C;&#x5141;&#x8BB8;&#x4FEE;&#x6539;&#x5C5E;&#x6027;&#x3002;</p>
<p>&#x6CE8;&#x610F;&#xFF0C;&#x4E0D;&#x80FD;&#x5728;&#x7ED3;&#x6784;&#x4F53;&#x7C7B;&#x578B;&#x7684;&#x5E38;&#x91CF;&#xFF08;a constant of structure type&#xFF09;&#x4E0A;&#x8C03;&#x7528;&#x53EF;&#x53D8;&#x65B9;&#x6CD5;&#xFF0C;&#x56E0;&#x4E3A;&#x5176;&#x5C5E;&#x6027;&#x4E0D;&#x80FD;&#x88AB;&#x6539;&#x53D8;&#xFF0C;&#x5373;&#x4F7F;&#x5C5E;&#x6027;&#x662F;&#x53D8;&#x91CF;&#x5C5E;&#x6027;&#xFF0C;&#x8BE6;&#x60C5;&#x53C2;&#x89C1; <a href="10_Properties.html#stored_properties_of_constant_structure_instances">&#x5E38;&#x91CF;&#x7ED3;&#x6784;&#x4F53;&#x7684;&#x5B58;&#x50A8;&#x5C5E;&#x6027;</a>&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-keyword">let</span> fixedPoint = <span class="hljs-type">Point</span>(x: <span class="hljs-number">3.0</span>, y: <span class="hljs-number">3.0</span>)
fixedPoint.moveBy(x: <span class="hljs-number">2.0</span>, y: <span class="hljs-number">3.0</span>)
<span class="hljs-comment">// &#x8FD9;&#x91CC;&#x5C06;&#x4F1A;&#x62A5;&#x544A;&#x4E00;&#x4E2A;&#x9519;&#x8BEF;</span>
</code></pre>
<h3 id="assigning-to-self-within-a-mutating-method">&#x5728;&#x53EF;&#x53D8;&#x65B9;&#x6CD5;&#x4E2D;&#x7ED9; self &#x8D4B;&#x503C; </h3>
<p>&#x53EF;&#x53D8;&#x65B9;&#x6CD5;&#x80FD;&#x591F;&#x8D4B;&#x7ED9;&#x9690;&#x542B;&#x5C5E;&#x6027; <code>self</code> &#x4E00;&#x4E2A;&#x5168;&#x65B0;&#x7684;&#x5B9E;&#x4F8B;&#x3002;&#x4E0A;&#x9762; <code>Point</code> &#x7684;&#x4F8B;&#x5B50;&#x53EF;&#x4EE5;&#x7528;&#x4E0B;&#x9762;&#x7684;&#x65B9;&#x5F0F;&#x6539;&#x5199;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Point</span> </span>{
    <span class="hljs-keyword">var</span> x = <span class="hljs-number">0.0</span>, y = <span class="hljs-number">0.0</span>
    <span class="hljs-keyword">mutating</span> <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">moveBy</span><span class="hljs-params">(x deltaX: Double, y deltaY: Double)</span></span> {
        <span class="hljs-keyword">self</span> = <span class="hljs-type">Point</span>(x: x + deltaX, y: y + deltaY)
    }
}
</code></pre>
<p>&#x65B0;&#x7248;&#x7684;&#x53EF;&#x53D8;&#x65B9;&#x6CD5; <code>moveBy(x:y:)</code> &#x521B;&#x5EFA;&#x4E86;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x7ED3;&#x6784;&#x4F53;&#x5B9E;&#x4F8B;&#xFF0C;&#x5B83;&#x7684; x &#x548C; y &#x7684;&#x503C;&#x90FD;&#x88AB;&#x8BBE;&#x5B9A;&#x4E3A;&#x76EE;&#x6807;&#x503C;&#x3002;&#x8C03;&#x7528;&#x8FD9;&#x4E2A;&#x7248;&#x672C;&#x7684;&#x65B9;&#x6CD5;&#x548C;&#x8C03;&#x7528;&#x4E0A;&#x4E2A;&#x7248;&#x672C;&#x7684;&#x6700;&#x7EC8;&#x7ED3;&#x679C;&#x662F;&#x4E00;&#x6837;&#x7684;&#x3002;</p>
<p>&#x679A;&#x4E3E;&#x7684;&#x53EF;&#x53D8;&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x628A; <code>self</code> &#x8BBE;&#x7F6E;&#x4E3A;&#x540C;&#x4E00;&#x679A;&#x4E3E;&#x7C7B;&#x578B;&#x4E2D;&#x4E0D;&#x540C;&#x7684;&#x6210;&#x5458;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">enum</span> <span class="hljs-title">TriStateSwitch</span> </span>{
    <span class="hljs-keyword">case</span> off, low, high
    <span class="hljs-keyword">mutating</span> <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">next</span><span class="hljs-params">()</span></span> {
        <span class="hljs-keyword">switch</span> <span class="hljs-keyword">self</span> {
        <span class="hljs-keyword">case</span> .off:
            <span class="hljs-keyword">self</span> = .low
        <span class="hljs-keyword">case</span> .low:
            <span class="hljs-keyword">self</span> = .high
        <span class="hljs-keyword">case</span> .high:
            <span class="hljs-keyword">self</span> = .off
        }
    }
}
<span class="hljs-keyword">var</span> ovenLight = <span class="hljs-type">TriStateSwitch</span>.low
ovenLight.next()
<span class="hljs-comment">// ovenLight &#x73B0;&#x5728;&#x7B49;&#x4E8E; .high</span>
ovenLight.next()
<span class="hljs-comment">// ovenLight &#x73B0;&#x5728;&#x7B49;&#x4E8E; .off</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x4E2D;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x4E09;&#x6001;&#x5207;&#x6362;&#x7684;&#x679A;&#x4E3E;&#x3002;&#x6BCF;&#x6B21;&#x8C03;&#x7528; <code>next()</code> &#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x5F00;&#x5173;&#x5728;&#x4E0D;&#x540C;&#x7684;&#x7535;&#x6E90;&#x72B6;&#x6001;&#xFF08;<code>off</code>, <code>low</code>, <code>high</code>&#xFF09;&#x4E4B;&#x95F4;&#x5FAA;&#x73AF;&#x5207;&#x6362;&#x3002;</p>
<h2 id="type-methods">&#x7C7B;&#x578B;&#x65B9;&#x6CD5; </h2>
<p>&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x662F;&#x88AB;&#x67D0;&#x4E2A;&#x7C7B;&#x578B;&#x7684;&#x5B9E;&#x4F8B;&#x8C03;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49;&#x5728;&#x7C7B;&#x578B;&#x672C;&#x8EAB;&#x4E0A;&#x8C03;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x5C31;&#x53EB;&#x505A;<em>&#x7C7B;&#x578B;&#x65B9;&#x6CD5;</em>&#x3002;&#x5728;&#x65B9;&#x6CD5;&#x7684; <code>func</code> &#x5173;&#x952E;&#x5B57;&#x4E4B;&#x524D;&#x52A0;&#x4E0A;&#x5173;&#x952E;&#x5B57; <code>static</code>&#xFF0C;&#x6765;&#x6307;&#x5B9A;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x3002;&#x7C7B;&#x8FD8;&#x53EF;&#x4EE5;&#x7528;&#x5173;&#x952E;&#x5B57; <code>class</code> &#x6765;&#x6307;&#x5B9A;&#xFF0C;&#x4ECE;&#x800C;&#x5141;&#x8BB8;&#x5B50;&#x7C7B;&#x91CD;&#x5199;&#x7236;&#x7C7B;&#x8BE5;&#x65B9;&#x6CD5;&#x7684;&#x5B9E;&#x73B0;&#x3002;</p>
<blockquote>
<p>&#x6CE8;&#x610F;</p>
<p>&#x5728; Objective-C &#x4E2D;&#xFF0C;&#x4F60;&#x53EA;&#x80FD;&#x4E3A; Objective-C &#x7684;&#x7C7B;&#x7C7B;&#x578B;&#xFF08;classes&#xFF09;&#x5B9A;&#x4E49;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#xFF08;type-level methods&#xFF09;&#x3002;&#x5728; Swift &#x4E2D;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x4E3A;&#x6240;&#x6709;&#x7684;&#x7C7B;&#x3001;&#x7ED3;&#x6784;&#x4F53;&#x548C;&#x679A;&#x4E3E;&#x5B9A;&#x4E49;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x3002;&#x6BCF;&#x4E00;&#x4E2A;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x90FD;&#x88AB;&#x5B83;&#x6240;&#x652F;&#x6301;&#x7684;&#x7C7B;&#x578B;&#x663E;&#x5F0F;&#x5305;&#x542B;&#x3002;</p>
</blockquote>
<p>&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x548C;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x4E00;&#x6837;&#x7528;&#x70B9;&#x8BED;&#x6CD5;&#x8C03;&#x7528;&#x3002;&#x4F46;&#x662F;&#xFF0C;&#x4F60;&#x662F;&#x5728;&#x7C7B;&#x578B;&#x4E0A;&#x8C03;&#x7528;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x5728;&#x5B9E;&#x4F8B;&#x4E0A;&#x8C03;&#x7528;&#x3002;&#x4E0B;&#x9762;&#x662F;&#x5982;&#x4F55;&#x5728; <code>SomeClass</code> &#x7C7B;&#x4E0A;&#x8C03;&#x7528;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SomeClass</span> </span>{
    <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">func</span> <span class="hljs-title">someTypeMethod</span>() </span>{
        <span class="hljs-comment">// &#x5728;&#x8FD9;&#x91CC;&#x5B9E;&#x73B0;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;</span>
    }
}
<span class="hljs-type">SomeClass</span>.someTypeMethod()
</code></pre>
<p>&#x5728;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x7684;&#x65B9;&#x6CD5;&#x4F53;&#xFF08;body&#xFF09;&#x4E2D;&#xFF0C;<code>self</code> &#x5C5E;&#x6027;&#x6307;&#x5411;&#x8FD9;&#x4E2A;&#x7C7B;&#x578B;&#x672C;&#x8EAB;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x7C7B;&#x578B;&#x7684;&#x67D0;&#x4E2A;&#x5B9E;&#x4F8B;&#x3002;&#x8FD9;&#x610F;&#x5473;&#x7740;&#x4F60;&#x53EF;&#x4EE5;&#x7528; <code>self</code> &#x6765;&#x6D88;&#x9664;&#x7C7B;&#x578B;&#x5C5E;&#x6027;&#x548C;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x4E4B;&#x95F4;&#x7684;&#x6B67;&#x4E49;&#xFF08;&#x7C7B;&#x4F3C;&#x4E8E;&#x6211;&#x4EEC;&#x5728;&#x524D;&#x9762;&#x5904;&#x7406;&#x5B9E;&#x4F8B;&#x5C5E;&#x6027;&#x548C;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x65F6;&#x505A;&#x7684;&#x90A3;&#x6837;&#xFF09;&#x3002;</p>
<p>&#x4E00;&#x822C;&#x6765;&#x8BF4;&#xFF0C;&#x5728;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x7684;&#x65B9;&#x6CD5;&#x4F53;&#x4E2D;&#xFF0C;&#x4EFB;&#x4F55;&#x672A;&#x9650;&#x5B9A;&#x7684;&#x65B9;&#x6CD5;&#x548C;&#x5C5E;&#x6027;&#x540D;&#x79F0;&#xFF0C;&#x53EF;&#x4EE5;&#x88AB;&#x672C;&#x7C7B;&#x4E2D;&#x5176;&#x4ED6;&#x7684;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x548C;&#x7C7B;&#x578B;&#x5C5E;&#x6027;&#x5F15;&#x7528;&#x3002;&#x4E00;&#x4E2A;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x901A;&#x8FC7;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x7684;&#x540D;&#x79F0;&#x8C03;&#x7528;&#x672C;&#x7C7B;&#x4E2D;&#x7684;&#x5176;&#x5B83;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#xFF0C;&#x800C;&#x65E0;&#x9700;&#x5728;&#x65B9;&#x6CD5;&#x540D;&#x79F0;&#x524D;&#x9762;&#x52A0;&#x4E0A;&#x7C7B;&#x578B;&#x540D;&#x79F0;&#x3002;&#x7C7B;&#x4F3C;&#x5730;&#xFF0C;&#x5728;&#x7ED3;&#x6784;&#x4F53;&#x548C;&#x679A;&#x4E3E;&#x4E2D;&#xFF0C;&#x4E5F;&#x80FD;&#x591F;&#x76F4;&#x63A5;&#x901A;&#x8FC7;&#x7C7B;&#x578B;&#x5C5E;&#x6027;&#x7684;&#x540D;&#x79F0;&#x8BBF;&#x95EE;&#x672C;&#x7C7B;&#x4E2D;&#x7684;&#x7C7B;&#x578B;&#x5C5E;&#x6027;&#xFF0C;&#x800C;&#x4E0D;&#x9700;&#x8981;&#x524D;&#x9762;&#x52A0;&#x4E0A;&#x7C7B;&#x578B;&#x540D;&#x79F0;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x540D;&#x4E3A; <code>LevelTracker</code> &#x7ED3;&#x6784;&#x4F53;&#x3002;&#x5B83;&#x76D1;&#x6D4B;&#x73A9;&#x5BB6;&#x7684;&#x6E38;&#x620F;&#x53D1;&#x5C55;&#x60C5;&#x51B5;&#xFF08;&#x6E38;&#x620F;&#x7684;&#x4E0D;&#x540C;&#x5C42;&#x6B21;&#x6216;&#x9636;&#x6BB5;&#xFF09;&#x3002;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x5355;&#x4EBA;&#x6E38;&#x620F;&#xFF0C;&#x4F46;&#x4E5F;&#x53EF;&#x4EE5;&#x5B58;&#x50A8;&#x591A;&#x4E2A;&#x73A9;&#x5BB6;&#x5728;&#x540C;&#x4E00;&#x8BBE;&#x5907;&#x4E0A;&#x7684;&#x6E38;&#x620F;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x6E38;&#x620F;&#x521D;&#x59CB;&#x65F6;&#xFF0C;&#x6240;&#x6709;&#x7684;&#x6E38;&#x620F;&#x7B49;&#x7EA7;&#xFF08;&#x9664;&#x4E86;&#x7B49;&#x7EA7; 1&#xFF09;&#x90FD;&#x88AB;&#x9501;&#x5B9A;&#x3002;&#x6BCF;&#x6B21;&#x6709;&#x73A9;&#x5BB6;&#x5B8C;&#x6210;&#x4E00;&#x4E2A;&#x7B49;&#x7EA7;&#xFF0C;&#x8FD9;&#x4E2A;&#x7B49;&#x7EA7;&#x5C31;&#x5BF9;&#x8FD9;&#x4E2A;&#x8BBE;&#x5907;&#x4E0A;&#x7684;&#x6240;&#x6709;&#x73A9;&#x5BB6;&#x89E3;&#x9501;&#x3002;<code>LevelTracker</code> &#x7ED3;&#x6784;&#x4F53;&#x7528;&#x7C7B;&#x578B;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#x76D1;&#x6D4B;&#x6E38;&#x620F;&#x7684;&#x54EA;&#x4E2A;&#x7B49;&#x7EA7;&#x5DF2;&#x7ECF;&#x88AB;&#x89E3;&#x9501;&#x3002;&#x5B83;&#x8FD8;&#x76D1;&#x6D4B;&#x6BCF;&#x4E2A;&#x73A9;&#x5BB6;&#x7684;&#x5F53;&#x524D;&#x7B49;&#x7EA7;&#x3002;</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">LevelTracker</span> </span>{
    <span class="hljs-keyword">static</span> <span class="hljs-keyword">var</span> highestUnlockedLevel = <span class="hljs-number">1</span>
    <span class="hljs-keyword">var</span> currentLevel = <span class="hljs-number">1</span>

    <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">unlock</span><span class="hljs-params">(<span class="hljs-number">_</span> level: Int)</span></span> {
        <span class="hljs-keyword">if</span> level &gt; highestUnlockedLevel { highestUnlockedLevel = level }
    }

    <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">isUnlocked</span><span class="hljs-params">(<span class="hljs-number">_</span> level: Int)</span></span> -&gt; <span class="hljs-type">Bool</span> {
        <span class="hljs-keyword">return</span> level &lt;= highestUnlockedLevel
    }

    @discardableResult
    <span class="hljs-keyword">mutating</span> <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">advance</span><span class="hljs-params">(to level: Int)</span></span> -&gt; <span class="hljs-type">Bool</span> {
        <span class="hljs-keyword">if</span> <span class="hljs-type">LevelTracker</span>.isUnlocked(level) {
            currentLevel = level
            <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>
        } <span class="hljs-keyword">else</span> {
            <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>
        }
    }
}
</code></pre>
<p><code>LevelTracker</code> &#x76D1;&#x6D4B;&#x73A9;&#x5BB6;&#x5DF2;&#x89E3;&#x9501;&#x7684;&#x6700;&#x9AD8;&#x7B49;&#x7EA7;&#x3002;&#x8FD9;&#x4E2A;&#x503C;&#x88AB;&#x5B58;&#x50A8;&#x5728;&#x7C7B;&#x578B;&#x5C5E;&#x6027; <code>highestUnlockedLevel</code> &#x4E2D;&#x3002;</p>
<p><code>LevelTracker</code> &#x8FD8;&#x5B9A;&#x4E49;&#x4E86;&#x4E24;&#x4E2A;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x4E0E; <code>highestUnlockedLevel</code> &#x914D;&#x5408;&#x5DE5;&#x4F5C;&#x3002;&#x7B2C;&#x4E00;&#x4E2A;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x662F; <code>unlock(_:)</code>&#xFF0C;&#x4E00;&#x65E6;&#x65B0;&#x7B49;&#x7EA7;&#x88AB;&#x89E3;&#x9501;&#xFF0C;&#x5B83;&#x4F1A;&#x66F4;&#x65B0; <code>highestUnlockedLevel</code> &#x7684;&#x503C;&#x3002;&#x7B2C;&#x4E8C;&#x4E2A;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x662F; <code>isUnlocked(_:)</code>&#xFF0C;&#x5982;&#x679C;&#x67D0;&#x4E2A;&#x7ED9;&#x5B9A;&#x7684;&#x7B49;&#x7EA7;&#x5DF2;&#x7ECF;&#x88AB;&#x89E3;&#x9501;&#xFF0C;&#x5B83;&#x5C06;&#x8FD4;&#x56DE; <code>true</code>&#x3002;&#xFF08;&#x6CE8;&#x610F;&#xFF0C;&#x5C3D;&#x7BA1;&#x6211;&#x4EEC;&#x6CA1;&#x6709;&#x4F7F;&#x7528;&#x7C7B;&#x4F3C; <code>LevelTracker.highestUnlockedLevel</code> &#x7684;&#x5199;&#x6CD5;&#xFF0C;&#x8FD9;&#x4E2A;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x8FD8;&#x662F;&#x80FD;&#x591F;&#x8BBF;&#x95EE;&#x7C7B;&#x578B;&#x5C5E;&#x6027; <code>highestUnlockedLevel</code>&#xFF09;</p>
<p>&#x9664;&#x4E86;&#x7C7B;&#x578B;&#x5C5E;&#x6027;&#x548C;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#xFF0C;<code>LevelTracker</code> &#x8FD8;&#x76D1;&#x6D4B;&#x6BCF;&#x4E2A;&#x73A9;&#x5BB6;&#x7684;&#x8FDB;&#x5EA6;&#x3002;&#x5B83;&#x7528;&#x5B9E;&#x4F8B;&#x5C5E;&#x6027; <code>currentLevel</code> &#x6765;&#x76D1;&#x6D4B;&#x6BCF;&#x4E2A;&#x73A9;&#x5BB6;&#x5F53;&#x524D;&#x7684;&#x7B49;&#x7EA7;&#x3002;</p>
<p>&#x4E3A;&#x4E86;&#x4FBF;&#x4E8E;&#x7BA1;&#x7406; <code>currentLevel</code> &#x5C5E;&#x6027;&#xFF0C;<code>LevelTracker</code> &#x5B9A;&#x4E49;&#x4E86;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5; <code>advance(to:)</code>&#x3002;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x4F1A;&#x5728;&#x66F4;&#x65B0; <code>currentLevel</code> &#x4E4B;&#x524D;&#x68C0;&#x67E5;&#x6240;&#x8BF7;&#x6C42;&#x7684;&#x65B0;&#x7B49;&#x7EA7;&#x662F;&#x5426;&#x5DF2;&#x7ECF;&#x89E3;&#x9501;&#x3002;<code>advance(to:)</code> &#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x5E03;&#x5C14;&#x503C;&#x4EE5;&#x6307;&#x793A;&#x662F;&#x5426;&#x80FD;&#x591F;&#x8BBE;&#x7F6E; <code>currentLevel</code>&#x3002;&#x56E0;&#x4E3A;&#x5141;&#x8BB8;&#x5728;&#x8C03;&#x7528; <code>advance(to:)</code> &#x65F6;&#x5019;&#x5FFD;&#x7565;&#x8FD4;&#x56DE;&#x503C;&#xFF0C;&#x4E0D;&#x4F1A;&#x4EA7;&#x751F;&#x7F16;&#x8BD1;&#x8B66;&#x544A;&#xFF0C;&#x6240;&#x4EE5;&#x51FD;&#x6570;&#x88AB;&#x6807;&#x6CE8;&#x4E3A; <code>@discardableResult</code> &#x5C5E;&#x6027;&#xFF0C;&#x66F4;&#x591A;&#x5173;&#x4E8E;&#x5C5E;&#x6027;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x8003; <a href="../chapter3/07_Attributes.html">&#x7279;&#x6027;</a>&#x7AE0;&#x8282;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#xFF0C;<code>Player</code> &#x7C7B;&#x4F7F;&#x7528; <code>LevelTracker</code> &#x6765;&#x76D1;&#x6D4B;&#x548C;&#x66F4;&#x65B0;&#x6BCF;&#x4E2A;&#x73A9;&#x5BB6;&#x7684;&#x53D1;&#x5C55;&#x8FDB;&#x5EA6;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Player</span> </span>{
    <span class="hljs-keyword">var</span> tracker = <span class="hljs-type">LevelTracker</span>()
    <span class="hljs-keyword">let</span> playerName: <span class="hljs-type">String</span>
    <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">complete</span><span class="hljs-params">(level: Int)</span></span> {
        <span class="hljs-type">LevelTracker</span>.unlock(level + <span class="hljs-number">1</span>)
        tracker.<span class="hljs-built_in">advance</span>(to: level + <span class="hljs-number">1</span>)
    }
    <span class="hljs-keyword">init</span>(name: <span class="hljs-type">String</span>) {
        playerName = name
    }
}
</code></pre>
<p><code>Player</code> &#x7C7B;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684; <code>LevelTracker</code> &#x5B9E;&#x4F8B;&#x6765;&#x76D1;&#x6D4B;&#x8FD9;&#x4E2A;&#x7528;&#x6237;&#x7684;&#x8FDB;&#x5EA6;&#x3002;&#x5B83;&#x63D0;&#x4F9B;&#x4E86; <code>complete(level:)</code> &#x65B9;&#x6CD5;&#xFF0C;&#x4E00;&#x65E6;&#x73A9;&#x5BB6;&#x5B8C;&#x6210;&#x67D0;&#x4E2A;&#x6307;&#x5B9A;&#x7B49;&#x7EA7;&#x5C31;&#x8C03;&#x7528;&#x5B83;&#x3002;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x4E3A;&#x6240;&#x6709;&#x73A9;&#x5BB6;&#x89E3;&#x9501;&#x4E0B;&#x4E00;&#x7B49;&#x7EA7;&#xFF0C;&#x5E76;&#x4E14;&#x5C06;&#x5F53;&#x524D;&#x73A9;&#x5BB6;&#x7684;&#x8FDB;&#x5EA6;&#x66F4;&#x65B0;&#x4E3A;&#x4E0B;&#x4E00;&#x7B49;&#x7EA7;&#x3002;&#xFF08;&#x6211;&#x4EEC;&#x5FFD;&#x7565;&#x4E86; <code>advance(to:)</code> &#x8FD4;&#x56DE;&#x7684;&#x5E03;&#x5C14;&#x503C;&#xFF0C;&#x56E0;&#x4E3A;&#x4E4B;&#x524D;&#x8C03;&#x7528; <code>LevelTracker.unlock(_:)</code> &#x65F6;&#x5C31;&#x77E5;&#x9053;&#x4E86;&#x8FD9;&#x4E2A;&#x7B49;&#x7EA7;&#x5DF2;&#x7ECF;&#x88AB;&#x89E3;&#x9501;&#x4E86;&#xFF09;&#x3002;</p>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x4E3A;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x73A9;&#x5BB6;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; <code>Player</code> &#x7684;&#x5B9E;&#x4F8B;&#xFF0C;&#x7136;&#x540E;&#x770B;&#x8FD9;&#x4E2A;&#x73A9;&#x5BB6;&#x5B8C;&#x6210;&#x7B49;&#x7EA7;&#x4E00;&#x65F6;&#x53D1;&#x751F;&#x4E86;&#x4EC0;&#x4E48;&#xFF1A;</p>
<pre><code class="lang-swift"><span class="hljs-keyword">var</span> player = <span class="hljs-type">Player</span>(name: <span class="hljs-string">&quot;Argyrios&quot;</span>)
player.complete(level: <span class="hljs-number">1</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;highest unlocked level is now <span class="hljs-subst">\(LevelTracker.highestUnlockedLevel)</span>&quot;</span>)
<span class="hljs-comment">// &#x6253;&#x5370;&#x201C;highest unlocked level is now 2&#x201D;</span>
</code></pre>
<p>&#x5982;&#x679C;&#x4F60;&#x521B;&#x5EFA;&#x4E86;&#x7B2C;&#x4E8C;&#x4E2A;&#x73A9;&#x5BB6;&#xFF0C;&#x5E76;&#x5C1D;&#x8BD5;&#x8BA9;&#x4ED6;&#x5F00;&#x59CB;&#x4E00;&#x4E2A;&#x6CA1;&#x6709;&#x88AB;&#x4EFB;&#x4F55;&#x73A9;&#x5BB6;&#x89E3;&#x9501;&#x7684;&#x7B49;&#x7EA7;&#xFF0C;&#x90A3;&#x4E48;&#x8BD5;&#x56FE;&#x8BBE;&#x7F6E;&#x73A9;&#x5BB6;&#x5F53;&#x524D;&#x7B49;&#x7EA7;&#x5C06;&#x4F1A;&#x5931;&#x8D25;&#xFF1A;</p>
<pre><code class="lang-swift">player = <span class="hljs-type">Player</span>(name: <span class="hljs-string">&quot;Beto&quot;</span>)
<span class="hljs-keyword">if</span> player.tracker.<span class="hljs-built_in">advance</span>(to: <span class="hljs-number">6</span>) {
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;player is now on level 6&quot;</span>)
} <span class="hljs-keyword">else</span> {
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;level 6 has not yet been unlocked&quot;</span>)
}
<span class="hljs-comment">// &#x6253;&#x5370;&#x201C;level 6 has not yet been unlocked&#x201D;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="10_Properties.html" class="navigation navigation-prev " aria-label="Previous page: 属性">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="12_Subscripts.html" class="navigation navigation-next " aria-label="Next page: 下标">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"方法","level":"1.3.11","depth":2,"next":{"title":"下标","level":"1.3.12","depth":2,"path":"chapter2/12_Subscripts.md","ref":"chapter2/12_Subscripts.md","articles":[]},"previous":{"title":"属性","level":"1.3.10","depth":2,"path":"chapter2/10_Properties.md","ref":"chapter2/10_Properties.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chapter2/11_Methods.md","mtime":"2019-07-05T01:01:08.039Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-07-05T02:41:17.672Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src=""></script>
    <script src=""></script>
    
        
        <script src=""></script>
        
    
        
        <script src=""></script>
        
    
        
        <script src=""></script>
        
    
        
        <script src=""></script>
        
    
        
        <script src=""></script>
        
    
        
        <script src=""></script>
        
    

    </body>
</html>

